﻿@using TinyMoocSite.ViewModels
@model ResourceVM

@{
    ViewBag.Title = Model.Title + "|课程资源";
    Layout = "~/Views/Teacher/CoursePageLayout.cshtml";
}

@section Resource { active }

@section RightContainer
{
    <h4>课程资源</h4><hr />
    <a href="/Teacher/AddResource?Id=@Model.Id" class="btn btn-primary">添加资源</a>
    <a href="/Teacher/ModuleManager?Id=@Model.Id" class="btn btn-primary disabled">模块管理</a>
    <br /><br />

    <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
    @foreach (ClassificatedResource list in Model.ClassificatedResourceList)
    {
        <div class="panel panel-default">
            <div class="panel-heading" role="tab" id="heading@list.Id">
                <h4 class="panel-title">
                    <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-@list.Id" aria-expanded="true" aria-controls="collapse-@list.Id">
                        @list.Caption
                    </a>
                </h4>
            </div>
            <div id="collapse-@list.Id" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading-@list.Id">
                <div class="panel-body">
                    <table class="table">
                        <thead>
                            <tr>
                                <th>资源名称</th>
                                <th>资源上传时间</th>
                                <th>资源类型</th>
                                <th>资源大小</th>
                                <th>下载次数</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (ResourceItem item in list.ResourceList)
                            {
                                <tr>
                                    <td>@item.Name</td>
                                    <td>@item.UploadDate</td>
                                    <td>@item.FileType</td>
                                    <td>@item.FileSize</td>
                                    <td>@item.DownloadCount</td>
                                    <td><a href="/Teacher/DownloadResource?Id=@item.Id">下载</a>&nbsp;&nbsp;
                                        <a href="/Teacher/RemoveResource?Id=@item.Id&courseId=@Model.Id">删除</a></td>
                                </tr>
                            }                            
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    }
    </div>        
}
